package com.liuning.droolsdemo;

import com.drools.core.KieTemplate;
import com.liuning.droolsdemo.entity.UserInfo;
import org.junit.Before;
import org.junit.jupiter.api.Test;
import org.kie.api.runtime.KieSession;
import org.springframework.boot.test.context.SpringBootTest;

import javax.annotation.Resource;

@SpringBootTest
public class Demo3 {

    @Resource
    private KieTemplate kieTemplate;


    @Before
    public void before() throws InterruptedException {
        Thread.sleep(1000);
    }

    @Test
    public void test01() {
        KieSession session = kieTemplate.getKieSession("rule3-1.drl");
        session.insert(0d);
        session.fireAllRules();

    }

    @Test
    public void test02() {
        KieSession session = kieTemplate.getKieSession("rule3-2.drl");
        session.insert(0d);
        session.fireAllRules();

    }

    @Test
    public void test03() {
        KieSession session = kieTemplate.getKieSession("rule3-3.drl");
        session.insert(0d);
        session.getAgenda().getAgendaGroup("a").setFocus();
        session.fireAllRules();

    }

    @Test
    public void test04() {
        KieSession session = kieTemplate.getKieSession("rule3-4.drl");
        session.insert(0d);
        session.fireAllRules();

    }

    @Test
    public void test05() {
        KieSession session = kieTemplate.getKieSession("rule3-5.drl");
        session.insert(0d);
        session.getAgenda().getAgendaGroup("a").setFocus();
        session.fireAllRules();

    }
}
